<!DOCTYPE html >
<html xmlns:th="http://www.thymeleaf.org">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<title>项目变更</title>

	<link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="/static/fonts/line-icons.css">
	<link href="/static/plugins/datatables/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
	<link href="/static/plugins/datatables/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" />
	<link href="/static/plugins/datatables/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" type="text/css" href="/static/css/main.css">
	<link rel="stylesheet" type="text/css" href="/static/css/responsive.css">

</head>
<body>
	<div class="app header-default side-nav-dark">
		<div class="layout">
			<!--顶部栏-->
			<div th:replace="~{/topbar::topbar}">
			</div>
			<!--侧边栏-->
			<div th:replace="~{/sidebar::sidebar}">
			</div>
			<!--主体部分-->
			<div class="page-container">

				<div class="main-content">
					<div class="container-fluid">

						<div class="breadcrumb-wrapper row">
							<div class="col-12 col-lg-3 col-md-6">
								<h4 class="page-title">项目信息一览表</h4>
							</div>
							<!--
							<div class="col-12 col-lg-9 col-md-6">
								<ol class="breadcrumb float-right">
									<li><a href="#">Tables</a></li>
									<li class="active"> / Data Table</li>
								</ol>
							</div>
							-->
						</div>

					</div>
					<div class="container-fluid">
						<div class="row">
							<div class="col-md-8">
								<span class="badge badge-default">项目更改</span>
								<br>
								<br>
								<form role="form" id="projectForm" onsubmit="return f()">
									<div class="form-group">

										<label for="projectname">
											项目名称：
										</label>
										<input type="text" class="form-control" id="projectname" name="projectName"
											   th:value="${project.getName()}" style="width:300px; height:40px;" />
										<input type="hidden" name="id" id="id" th:value="${project.getId()}">
									</div>
									<div class="form-group">

										<label for="projectid">
											项目编号：
										</label>
										<input type="text" class="form-control" id="projectid" name="projectId"
											   th:value="${project.getNumber()}" style="width:300px; height:40px;" />
									</div>
									<div class="form-group">

										<label for="projectleader">
											负责人:
										</label>
										<input type="text" class="form-control" id="projectleader" name="projectLeader"
											   th:value="${project.getLeader()}" style="width:300px; height:40px;" />
									</div>
									<div class="form-group">

										<label for="member">
											成员:
										</label>
										<br>
										<input id="member" name="member" type="checkbox" th:each="member:${members}" th:value="${member.getUid()}"
											   th:text="${member.name}" th:checked="${member.isBe()}">
										<!--<input id="member" name="member" type="checkbox" th:each="mem:${members}" th:value="${mem.getUid()}"-->
											   <!--th:text="${mem.name}" th:checked="${mem.isBe()}">-->
									</div>
									<div class="form-group">

										<label for="budget">
											项目预算:
										</label>
										<input type="text" class="form-control" id="budget" name="budget"
											   th:value="${project.getBudget()}" style="width:300px; height:40px;" />
									</div>
									<div class="form-group">

										<label for="org">
											所属组织机构:
										</label>
										<select name="org" id = "org">
											<option th:each="org:${orgList}" th:value="${org.id}" th:text="${org.name}">scau</option>
										</select>
									</div>
									<div class="form-group">

										<label for="ins">
											所属科研平台:
										</label>
										<select name="ins" id = "ins">
											<option th:each="ins:${insList}" th:value="${ins.id}" th:text="${ins.name}"
											th:selected="${project.getInstitution() eq ins.name}">scau</option>
										</select>
									</div>
									<div class="form-group">

										<label for="level">
											项目级别
										</label>
										<select name="level" id="level" th:value="${project.getLever()}">
											<option value="院级">院级</option>
											<option value="校级">校级</option>
											<option value="省级">省级</option>
											<option value="国家级">国家级</option>
										</select>
									</div>
									<div class="form-group">

										<label for="projectFile">
											项目文档
										</label>
										<input type="file" class="form-control-file" id="projectFile" name="projectFile"/>
										<br>
										<button type="submit" class="btn btn-primary">
											Submit
										</button>
									</div>
								</form>
							</div>
						</div>
					</div>


					<footer class="content-footer">
						<div th:replace="~{/footer::footer}"></div>
					</footer>

				</div>

			</div>
		</div>
	</div>
	<script src="/static/js/jquery-min.js"></script>
	<script src="/static/js/popper.min.js"></script>
	<script src="/static/js/bootstrap.min.js"></script>
	<script src="/static/js/scripts.js"></script>
	<script src="/static/js/jquery.app.js"></script>
	<script src="/static/js/main.js"></script>

	<script src="/static/plugins/datatables/jquery.dataTables.min.js"></script>
	<script src="/static/plugins/datatables/dataTables.bootstrap4.min.js"></script>

	<script src="/static/plugins/datatables/dataTables.buttons.min.js"></script>
	<script src="/static/plugins/datatables/buttons.bootstrap4.min.js"></script>
	<script src="/static/plugins/datatables/jszip.min.js"></script>
	<script src="/static/plugins/datatables/pdfmake.min.js"></script>
	<script src="/static/plugins/datatables/vfs_fonts.js"></script>
	<script src="/static/plugins/datatables/buttons.html5.min.js"></script>
	<script src="/static/plugins/datatables/buttons.print.min.js"></script>
	<script src="/static/plugins/datatables/buttons.colVis.min.js"></script>
	<script src="/static/plugins/datatables/dataTables.responsive.min.js"></script>
	<script src="/static/plugins/datatables/responsive.bootstrap4.min.js"></script>
	<script src="/static/js/datatables.init.js"></script>

	<script type="text/javascript">
        function f() {
            var formData = new FormData($('#projectForm')[0]);
            formData.append("isChange","yes");
            // formData.append("id",$('#id'));
            $.ajax({
                url:"/project/apply",
                type:"post",
                data:formData,
				processData:false,
				contentType:false,
                success:function (result) {
                    if (result && result.success) {
                        alert("提交成功");
                        window.location.href = "/project/list";
                    } else {
                        alert(result.msg);
                    }
                }
            });
            return false;
        }
	</script>
	</body>
	</html>